package auctioncentral;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

/**
 * This test class tests methods of the AuctionSystem class.
 * 
 * @author Kyle Scharnhorst, Andres Rosales (acr)
 * @version 0.2 acr
 */
public class AuctionSystemTest extends AuctionSystem {

  //instance fields
  
  /**
   * The array of all the events.
   */
  private List<Event> my_test_events = new ArrayList<Event>();
  
  /**
   * The list of abstract users.
   */
  private List<AbstractUser> my_users;
  
  /**
   * The system.
   */
  private AuctionSystem my_system;
  
  /**
   * my event to find.
   */
  private Event my_test_event = new Event("", "", "", "", new GregorianCalendar(7, 7, 7), 0, 0, "");
  
  /**
   * Sets up test preconditions.
   */
  @Before
  public void setUp() {
    my_test_events.add(new Event("", "", "", "", new GregorianCalendar(10, 10, 10), 0, 0, ""));
    my_test_events.add(new Event("", "", "", "", new GregorianCalendar(9, 9, 9), 0, 0, ""));
    my_test_events.add(new Event("", "", "", "", new GregorianCalendar(8, 8, 8), 0, 0, ""));
    my_test_events.add(new Event("", "", "", "", new GregorianCalendar(7, 7, 7), 0, 0, ""));
    
    my_users = new ArrayList<AbstractUser>();
    my_system = new AuctionSystem();
  }  
  
  /**
   * tests hasUser()
   */
  @Test
  public void testHasUser() {
	  my_users.add(new AuthNonProfitUser("bob", "", "", ""));
	  my_system.setUserList(my_users);
	  assertTrue(my_system.hasUser("bob"));
  }
  
  /**
   * tests findUser()
   */
  @Test
  public void testFindUser() {
	  AbstractUser tester = new AuthNonProfitUser("meep", "", "", "");
	  my_users.add(tester);
	  my_system.setUserList(my_users);
	  assertTrue(my_system.getUser("meep").equals(tester));
  }
  
}
